﻿@*
    第三方授权
*@
@model BindsModel
@using NewLife.Cube.Areas.Admin.Models;
@using System.Linq;
@using System.Reflection;
@using XCode;
@using XCode.Configuration
@using NewLife.Cube.Entity;
@using XCode.Membership;
@using NewLife;

@{
    var ms = Model.OAuthItems;
    var binds = Model.Connects;
}

<div class="row m-0">
    <div class=" col-xl-3 col-lg-4">
        <div class="card  pb-lg-20">
            <div class="card-header">
                <h4 class="card-title text-muted">信息选项</h4>
            </div>

            <div class="text-center col-md-12 cube-flex-con cube-flex-items">
                <ul class="nav nav-tabs nav-pills flex-row border-0 flex-md-column mt-2 mb-3 mb-md-0 fs-6">
                    <li class="nav-item me-0 pt-2 pm-3 text-start">
                        <a class="nav-link text-gray-700" href="@Url.Action("info")"><span class="fas fa-user text-gray-700 pe-5"></span>基本信息</a>
                    </li>
                    <li class="nav-item me-0 pt-2 pm-3 text-start">
                        <a class="nav-link text-gray-700" href="@Url.Action("ChangePassword")"><span class="fas fa-unlock text-info pe-5"></span>修改密码</a>
                    </li>
                    <li class="nav-item me-0 pt-2 pm-3 text-start">
                        <a class="nav-link active bg-light-info text-info" href="@Url.Action("Binds")"><span class="fas fa-user-lock text-gray-700 pe-5"></span>第三方授权</a>
                    </li>

                </ul>
            </div>

        </div>



    </div>

    <div class="col-xl-9 col-lg-8">
        <div class="card mb-5 mb-xl-10">
            <div class="card-header cursor-pointer">
                <div class="card-title m-0">
                    <h3 class="card-title text-muted">第三方授权</h3>
                </div>
            </div>

            <div class="card-body p-9">

                <div class="row mb-5">
                    <label class="col-3 col-form-label d-flex justify-content-end text-muted">账号</label>
                    <div class="col-lg-4">
                        <input value="@Model.Name" type="text" class="form-control form-control-sm" disabled="disabled" />
                    </div>
                    <label class="col-lg-5 text-muted"></label>
                </div>


                @if (ms.Count > 0)
                {
                    foreach (var mi in ms)
                    {
                        var uc = binds.FirstOrDefault(e => e.Enable && e.Provider.EqualIgnoreCase(mi.Name));
                        if (uc != null)
                        {
                            <div class="row mb-5">
                                <label class="col-3 col-form-label d-flex justify-content-end text-muted">@mi.Name（已绑定）</label>
                                <a class="col-4 col-form-label" href="~/Sso/UnBind/@mi.Name" title="取消绑定 @mi.Name">取消绑定</a>
                                <label class="col-lg-5 text-muted"></label>
                            </div>
                        }
                        else
                        {
                            <div class="row mb-5">
                                <label class="col-3 col-form-label d-flex justify-content-end text-muted">@mi.Name（未绑定）</label>
                                <a class="col-4 col-form-label" href="~/Sso/Bind/@mi.Name" target="_blank" title="绑定 @mi.Name">去绑定</a>
                                <label class="col-lg-5 text-muted"></label>
                            </div>
                        }

                    }

                }



                <div class="clearfix form-actions col-sm-12 col-md-12 mt-10 mb-20">

                </div>




            </div>
        </div>

    </div>
</div>

